From 67a1a6ac1667cf6968b8007888654b4b940ea820 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Mon, 15 Jan 2024 22:39:12 +0000
Subject: [PATCH 2/2] disable warning-as-error when building gcc

needed, because newer host gcc will treat warnings as errors,
and some of this older code will trip on the newer handling.

Signed-off-by: Leah Rowe <info@minifree.org>
---
 util/crossgcc/buildgcc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index dd32ee6ba8..5e6a3310a7 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -609,7 +609,7 @@ set_hostcflags_from_gmp() {
 	# Now set CFLAGS to match GMP CFLAGS but strip out -pedantic
 	# as GCC 4.6.x fails if it's there.
 	HOSTCFLAGS="$(grep __GMP_CFLAGS "$DESTDIR$TARGETDIR/include/gmp.h" |cut -d\" -f2 |\
-	    sed s,-pedantic,,)"
+	    sed s,-pedantic,,) -Wno-error -w"
 	export HOSTCFLAGS
 }
 
@@ -698,13 +698,13 @@ build_BINUTILS() {
 
 bootstrap_GCC() {
 	# shellcheck disable=SC2086
-	CC="$(hostcc host)" CXX="$(hostcxx host)" \
-		CFLAGS="$HOSTCFLAGS" \
-		CFLAGS_FOR_BUILD="$HOSTCFLAGS" \
-		CFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC" \
-		CXXFLAGS="$HOSTCFLAGS" \
-		CXXFLAGS_FOR_BUILD="$HOSTCFLAGS" \
-		CXXFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC" \
+	CC="$(hostcc host) -Wno-error -w" CXX="$(hostcxx host) -Wno-error -w" \
+		CFLAGS="$HOSTCFLAGS -Wno-error -w" \
+		CFLAGS_FOR_BUILD="$HOSTCFLAGS -Wno-error -w" \
+		CFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC -Wno-error -w" \
+		CXXFLAGS="$HOSTCFLAGS -Wno-error -w" \
+		CXXFLAGS_FOR_BUILD="$HOSTCFLAGS -Wno-error -w" \
+		CXXFLAGS_FOR_TARGET="$HOSTCFLAGS -fPIC -Wno-error -w" \
 		../gcc-${GCC_VERSION}/configure \
 		--prefix="$TARGETDIR" --libexecdir="$TARGETDIR/lib" \
 		--enable-bootstrap \
@@ -1021,7 +1021,7 @@ if [ -n "$CC" ]; then
 	fi
 else
 	if searchtool gnatgcc "Free Software Foundation" nofail > /dev/null; then
-		CC=gnatgcc
+		CC="gnatgcc"
 	elif searchtool gcc "Free Software Foundation" nofail > /dev/null; then
 		CC=gcc
 	else
@@ -1143,7 +1143,7 @@ if ada_requested; then
 fi
 fi # GCC
 
-export HOSTCFLAGS="-Os"
+export HOSTCFLAGS="-Os -Wno-error -w"
 if have_hostcflags_from_gmp; then
 	set_hostcflags_from_gmp
 fi
-- 
2.39.2

